<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta name="layout" content="main" />
    <g:set var="entityName" value="${message(code: 'birt.reportParameters.label', default: 'Report Parameters')}" />
    <title><g:message code="default.edit.label" args="[entityName]" /></title>
	<script type="text/javascript" language="javascript">
	// <![CDATA[
		function displayWait(){
			$('#form_pane').hide();
			$('#wait_indicator').show();
			return true;
		}
	// ]]>
	</script>
</head>
<body>
<div class="body">
	<div id="wait_indicator" style="display: none;text-align:center;padding-top:50px;">
		<b>Generating Report, please wait...</b>
		<br/><br/>
		<img src="${resource(dir:'images',file:'spinner.gif')}" alt="Working..." />
	</div>
	<div id="form_pane">
		<h1><g:message code="default.edit.label" args="[entityName]" />: ${id }</h1>
			<g:if test="${message}">
				<div class="message">${message}</div>
			</g:if>
			<g:if test="${error }">
				<div class="errors">${error}</div>
			</g:if>
			<g:form action="view" method="post" id="${id}" onSubmit="displayWait()">
				<div class="dialog">
					<table>
						<tbody>
							<g:each var="p" in="${parameters}">
								<g:if test="${p.defaultVal && !reportParams[showAll]}" >
									<input type="hidden" name="${p.name}" value="${reportParams[p.defaultVal]}" /> 
								</g:if><g:else>
									<tr class="prop">
										<td valign="top" class="name">
											<label for='${p.name}'>${p.promptText?:p.name}:</label>
										</td>
										<td valign="top" class="value">
											<g:if test="${p.type==7}">
												<g:if test="${showAll ||!reportParams[p.name]}">
													<g:if test="${reportParams[p.name]}">
														<g:textField name="${p.name}" value=""${reportParams[p.name]} />
														<g:javascript>
															$(function() {
																$( "#${p.name}" ).datepicker({dateFormat: 'yy-mm-dd'});
															});
														</g:javascript>
													</g:if><g:else>
														<g:textField name="${p.name}" value="" />
														<g:javascript>
															$(function() {
																$( "#${p.name}" ).datepicker({dateFormat: 'yy-mm-dd'});
															});
														</g:javascript>
													</g:else>
												</g:if><g:else>
													<g:textField name="${p.name}" value="${reportParams[p.name]}" class="readonly" readonly="readonly"/>
												</g:else>
											</g:if><g:else>
												<g:if test="${showAll!=null || reportParams[p.name]==null }">
													<g:if test="${p.listEntries?.size()>0}">
														<g:select name="${p.name}" from="${p.listEntries}" value="${reportParams[p.name]?:p.defaultVal}" optionKey="value" optionValue="label"/>
													</g:if><g:else>
														<g:textField name="${p.name}" value="${reportParams[p.name]?:p.defaultVal}" />
													</g:else>
												</g:if><g:else>
													<g:textField name="${p.name}" value="${reportParams[p.name]}" class="readonly" readonly="readonly"/>
												</g:else>
											</g:else>
											<g:if test="${!p.allowBlank }"><span class="unit"><g:message code="birt.reportParameters.required.label" /> </span></g:if>
										</td>
										<td valign="top" class="value">${p.helpText}</td>
									</tr>
								</g:else>
							</g:each>
						</tbody>
					</table>
				</div>
				<div class="buttons">
					<g:submitButton class="save" name="run" value="View Report" />&nbsp;&nbsp;&nbsp;
				</div>
			</g:form>
		</div>
	</div>
</body>
</html>